<template>
    <div>
        <h3>权益增加</h3>
        <table class="table table-bordered">
            <tbody>
                <tr>
                    <td align="right">权益名称</td>
                    <td>
                        <input type="text" v-model="querinfo.RightName">
                    </td>
                </tr>
                <tr>
                    <td align="right"></td>
                    <td>
                        <input type="button" value="添加" class="btn btn-primary" @click="ok">
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import { ref, reactive, onMounted, useSlots } from 'vue';
import { useRouter, useRoute } from 'vue-router';
import moment from 'moment';
import axios from 'axios';
const route = useRoute();
const router = useRouter();
let querinfo=reactive({
"RightName": "",
})

const ok=()=>{
    if(querinfo.RightName==""){
        alert('权益名称不能为空')
    }
    axios({
        method:"post",
        url:"/api/Member/RightAdd",
        data:querinfo
    })
    .then(res=>{
        if(res.data==-1){
            alert('权益名称重复')
        }
        else if(res.data>0){
            alert('添加成功')
            router.push('/rightlist')
        }
        else{
            alert('添加失败')
        }
    })
    .catch(err=>{
        console.log(err)
    })
}



</script>







<style scoped>

</style>